using Coding4Fun.Phone.Controls.Primitives;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Threading;
namespace Coding4Fun.Phone.Controls.Toolkit.Primitives
{
	[TemplatePart(Name = "ItemsPanel", Type = typeof(Panel)), TemplatePart(Name = "PanningTransform", Type = typeof(TranslateTransform)), TemplatePart(Name = "CenteringTransform", Type = typeof(TranslateTransform))]
	public class LoopingSelector : Control
	{
		private enum Enum0
		{
			const_0,
			const_1,
			const_2,
			const_3,
			const_4
		}
		[CompilerGenerated]
		private sealed class Class31
		{
			public LoopingSelector loopingSelector_0;
			public LoopingSelectorItem loopingSelectorItem_0;
			public void method_0()
			{
				this.loopingSelector_0.bool_0 = true;
				this.loopingSelector_0.DataSource.SelectedItem = this.loopingSelectorItem_0.get_DataContext();
				this.loopingSelector_0.bool_0 = false;
			}
		}
		private const string string_0 = "ItemsPanel";
		private const string string_1 = "CenteringTransform";
		private const string string_2 = "PanningTransform";
		private const double double_0 = 12.0;
		private static readonly Duration duration_0 = new Duration(TimeSpan.FromMilliseconds(500.0));
		private readonly IEasingFunction ieasingFunction_0;
		private static readonly Duration duration_1 = new Duration(TimeSpan.FromMilliseconds(100.0));
		private readonly IEasingFunction ieasingFunction_1;
		private DoubleAnimation doubleAnimation_0;
		private Storyboard storyboard_0;
		private Panel panel_0;
		private TranslateTransform translateTransform_0;
		private TranslateTransform translateTransform_1;
		private bool bool_0;
		private LoopingSelectorItem loopingSelectorItem_0;
		private Queue<LoopingSelectorItem> queue_0;
		private double double_1;
		private double double_2;
		private int int_0;
		private bool bool_1;
		private double double_3;
		private bool bool_2;
		private bool bool_3;
		private LoopingSelector.Enum0 enum0_0;
		public static readonly DependencyProperty DataSourceProperty = DependencyProperty.Register("DataSource", typeof(ILoopingSelectorDataSource), typeof(LoopingSelector), new PropertyMetadata(null, new PropertyChangedCallback(LoopingSelector.smethod_0)));
		public static readonly DependencyProperty ItemTemplateProperty = DependencyProperty.Register("ItemTemplate", typeof(DataTemplate), typeof(LoopingSelector), new PropertyMetadata(null));
		public static readonly DependencyProperty IsExpandedProperty = DependencyProperty.Register("IsExpanded", typeof(bool), typeof(LoopingSelector), new PropertyMetadata(false, new PropertyChangedCallback(LoopingSelector.OnIsExpandedChanged)));
		private DependencyPropertyChangedEventHandler dependencyPropertyChangedEventHandler_0;
		[CompilerGenerated]
		private Size size_0;
		[CompilerGenerated]
		private Thickness thickness_0;
		public event DependencyPropertyChangedEventHandler IsExpandedChanged
		{
			add
			{
				DependencyPropertyChangedEventHandler dependencyPropertyChangedEventHandler = this.dependencyPropertyChangedEventHandler_0;
				DependencyPropertyChangedEventHandler dependencyPropertyChangedEventHandler2;
				do
				{
					dependencyPropertyChangedEventHandler2 = dependencyPropertyChangedEventHandler;
					DependencyPropertyChangedEventHandler dependencyPropertyChangedEventHandler3 = (DependencyPropertyChangedEventHandler)Delegate.Combine(dependencyPropertyChangedEventHandler2, value);
					dependencyPropertyChangedEventHandler = Interlocked.CompareExchange<DependencyPropertyChangedEventHandler>(ref this.dependencyPropertyChangedEventHandler_0, dependencyPropertyChangedEventHandler3, dependencyPropertyChangedEventHandler2);
				}
				while (dependencyPropertyChangedEventHandler != dependencyPropertyChangedEventHandler2);
			}
			remove
			{
				DependencyPropertyChangedEventHandler dependencyPropertyChangedEventHandler = this.dependencyPropertyChangedEventHandler_0;
				DependencyPropertyChangedEventHandler dependencyPropertyChangedEventHandler2;
				do
				{
					dependencyPropertyChangedEventHandler2 = dependencyPropertyChangedEventHandler;
					DependencyPropertyChangedEventHandler dependencyPropertyChangedEventHandler3 = (DependencyPropertyChangedEventHandler)Delegate.Remove(dependencyPropertyChangedEventHandler2, value);
					dependencyPropertyChangedEventHandler = Interlocked.CompareExchange<DependencyPropertyChangedEventHandler>(ref this.dependencyPropertyChangedEventHandler_0, dependencyPropertyChangedEventHandler3, dependencyPropertyChangedEventHandler2);
				}
				while (dependencyPropertyChangedEventHandler != dependencyPropertyChangedEventHandler2);
			}
		}
		public ILoopingSelectorDataSource DataSource
		{
			get
			{
				return (ILoopingSelectorDataSource)base.GetValue(LoopingSelector.DataSourceProperty);
			}
			set
			{
				if (this.DataSource != null)
				{
					this.DataSource.SelectionChanged -= new EventHandler<SelectionChangedEventArgs>(this.method_0);
				}
				base.SetValue(LoopingSelector.DataSourceProperty, value);
				if (value != null)
				{
					value.SelectionChanged += new EventHandler<SelectionChangedEventArgs>(this.method_0);
				}
			}
		}
		public DataTemplate ItemTemplate
		{
			get
			{
				return (DataTemplate)base.GetValue(LoopingSelector.ItemTemplateProperty);
			}
			set
			{
				base.SetValue(LoopingSelector.ItemTemplateProperty, value);
			}
		}
		public Size ItemSize
		{
			get;
			set;
		}
		public Thickness ItemMargin
		{
			get;
			set;
		}
		public bool IsExpanded
		{
			get
			{
				return (bool)base.GetValue(LoopingSelector.IsExpandedProperty);
			}
			set
			{
				base.SetValue(LoopingSelector.IsExpandedProperty, value);
			}
		}
		private bool IsReady
		{
			get
			{
				return base.get_ActualHeight() > 0.0 && this.DataSource != null && this.panel_0 != null;
			}
		}
		private double ActualItemWidth
		{
			get
			{
				return base.get_Padding().get_Left() + base.get_Padding().get_Right() + this.ItemSize.get_Width();
			}
		}
		private double ActualItemHeight
		{
			get
			{
				return base.get_Padding().get_Top() + base.get_Padding().get_Bottom() + this.ItemSize.get_Height();
			}
		}
		private void method_0(object sender, SelectionChangedEventArgs e)
		{
			if (!this.IsReady)
			{
				return;
			}
			if (!this.bool_0 && e.get_AddedItems().get_Count() == 1)
			{
				object obj = e.get_AddedItems().get_Item(0);
				using (IEnumerator<UIElement> enumerator = this.panel_0.get_Children().GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						LoopingSelectorItem loopingSelectorItem = (LoopingSelectorItem)enumerator.get_Current();
						if (loopingSelectorItem.get_DataContext() == obj)
						{
							this.method_8(loopingSelectorItem);
							return;
						}
					}
				}
				this.method_9();
			}
		}
		private static void smethod_0(DependencyObject dependencyObject_0, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			LoopingSelector loopingSelector = (LoopingSelector)dependencyObject_0;
			loopingSelector.method_9();
		}
		public LoopingSelector()
		{
			ExponentialEase exponentialEase = new ExponentialEase();
			exponentialEase.set_EasingMode(2);
			this.ieasingFunction_0 = exponentialEase;
			this.ieasingFunction_1 = new ExponentialEase();
			this.double_1 = -3.4028234663852886E+38;
			this.double_2 = 3.4028234663852886E+38;
			this.bool_2 = true;
			base..ctor();
			base.set_DefaultStyleKey(typeof(LoopingSelector));
			this.method_19();
		}
		private static void OnIsExpandedChanged(object sender, DependencyPropertyChangedEventArgs e)
		{
			LoopingSelector loopingSelector = (LoopingSelector)sender;
			loopingSelector.method_17();
			if (!loopingSelector.IsExpanded)
			{
				loopingSelector.method_16();
			}
			if (loopingSelector.enum0_0 == LoopingSelector.Enum0.const_0 || loopingSelector.enum0_0 == LoopingSelector.Enum0.const_1)
			{
				loopingSelector.enum0_0 = (loopingSelector.IsExpanded ? LoopingSelector.Enum0.const_1 : LoopingSelector.Enum0.const_0);
			}
			DependencyPropertyChangedEventHandler dependencyPropertyChangedEventHandler = loopingSelector.dependencyPropertyChangedEventHandler_0;
			if (dependencyPropertyChangedEventHandler != null)
			{
				dependencyPropertyChangedEventHandler.Invoke(loopingSelector, e);
			}
		}
		public override void OnApplyTemplate()
		{
			base.OnApplyTemplate();
			this.panel_0 = ((base.GetTemplateChild("ItemsPanel") as Panel) ?? new Canvas());
			this.translateTransform_1 = ((base.GetTemplateChild("CenteringTransform") as TranslateTransform) ?? new TranslateTransform());
			this.translateTransform_0 = ((base.GetTemplateChild("PanningTransform") as TranslateTransform) ?? new TranslateTransform());
			this.method_18();
		}
		private void method_1(object sender, MouseButtonEventArgs e)
		{
			if (this.bool_1)
			{
				double y = this.translateTransform_0.get_Y();
				this.method_11();
				this.translateTransform_0.set_Y(y);
				this.bool_1 = false;
				this.enum0_0 = LoopingSelector.Enum0.const_2;
			}
		}
		private void method_2(object sender, MouseButtonEventArgs e)
		{
			if (this.loopingSelectorItem_0 != sender && this.enum0_0 == LoopingSelector.Enum0.const_2 && !this.bool_1)
			{
				this.method_16();
				this.enum0_0 = LoopingSelector.Enum0.const_1;
			}
		}
		private void method_3(object sender, GestureEventArgs e)
		{
			if (this.translateTransform_0 != null)
			{
				this.method_16();
				e.set_Handled(true);
			}
		}
		private void method_4(object sender, ManipulationStartedEventArgs e)
		{
			this.bool_2 = true;
			this.bool_3 = false;
		}
		private void method_5(object sender, ManipulationDeltaEventArgs e)
		{
			if (this.bool_3)
			{
				this.method_10(LoopingSelector.duration_1, this.ieasingFunction_1, this.double_3 += e.get_DeltaManipulation().get_Translation().get_Y());
				e.set_Handled(true);
				return;
			}
			if (Math.Abs(e.get_CumulativeManipulation().get_Translation().get_X()) > 12.0)
			{
				this.bool_2 = false;
				return;
			}
			if (this.bool_2 && Math.Abs(e.get_CumulativeManipulation().get_Translation().get_Y()) > 12.0)
			{
				this.bool_3 = true;
				this.enum0_0 = LoopingSelector.Enum0.const_2;
				e.set_Handled(true);
				this.loopingSelectorItem_0 = null;
				if (!this.IsExpanded)
				{
					this.IsExpanded = true;
				}
				this.double_3 = this.translateTransform_0.get_Y();
				this.method_17();
			}
		}
		private void method_6(object sender, ManipulationCompletedEventArgs e)
		{
			if (this.bool_3)
			{
				if (e.get_IsInertial())
				{
					this.enum0_0 = LoopingSelector.Enum0.const_4;
					this.loopingSelectorItem_0 = null;
					if (!this.IsExpanded)
					{
						this.IsExpanded = true;
					}
					Point point_ = new Point(0.0, e.get_FinalVelocities().get_LinearVelocity().get_Y());
					double num = Class35.smethod_0(point_);
					Point point = Class35.smethod_1(point_);
					IEasingFunction ieasingFunction_ = Class35.smethod_2(num);
					this.method_10(new Duration(TimeSpan.FromSeconds(num)), ieasingFunction_, this.translateTransform_0.get_Y() + point.get_Y());
					e.set_Handled(true);
					this.loopingSelectorItem_0 = null;
					this.method_17();
				}
				if (this.enum0_0 == LoopingSelector.Enum0.const_2)
				{
					this.method_16();
				}
				this.enum0_0 = LoopingSelector.Enum0.const_1;
			}
		}
		private void LoopingSelector_SizeChanged(object sender, SizeChangedEventArgs e)
		{
			this.translateTransform_1.set_Y(Math.Round(e.get_NewSize().get_Height() / 2.0));
			RectangleGeometry rectangleGeometry = new RectangleGeometry();
			rectangleGeometry.set_Rect(new Rect(0.0, 0.0, e.get_NewSize().get_Width(), e.get_NewSize().get_Height()));
			base.set_Clip(rectangleGeometry);
			this.method_9();
		}
		private void method_7(object sender, EventArgs e)
		{
			if (this.enum0_0 == LoopingSelector.Enum0.const_0)
			{
				this.enum0_0 = LoopingSelector.Enum0.const_1;
				this.IsExpanded = true;
				return;
			}
			if (this.enum0_0 == LoopingSelector.Enum0.const_1)
			{
				if (!this.bool_1 && sender == this.loopingSelectorItem_0)
				{
					this.enum0_0 = LoopingSelector.Enum0.const_0;
					this.IsExpanded = false;
					return;
				}
				if (sender != this.loopingSelectorItem_0 && !this.bool_1)
				{
					this.method_8((LoopingSelectorItem)sender);
				}
			}
		}
		private void method_8(LoopingSelectorItem loopingSelectorItem_1)
		{
			Action action = null;
			LoopingSelector.Class31 @class = new LoopingSelector.Class31();
			@class.loopingSelectorItem_0 = loopingSelectorItem_1;
			@class.loopingSelector_0 = this;
			if (@class.loopingSelectorItem_0 == null)
			{
				return;
			}
			if (this.loopingSelectorItem_0 != null)
			{
				this.loopingSelectorItem_0.method_0(this.IsExpanded ? LoopingSelectorItem.Enum1.const_1 : LoopingSelectorItem.Enum1.const_0, true);
			}
			if (this.loopingSelectorItem_0 != @class.loopingSelectorItem_0)
			{
				this.loopingSelectorItem_0 = @class.loopingSelectorItem_0;
				Dispatcher arg_70_0 = base.get_Dispatcher();
				if (action == null)
				{
					action = new Action(@class.method_0);
				}
				arg_70_0.BeginInvoke(action);
			}
			this.loopingSelectorItem_0.method_0(LoopingSelectorItem.Enum1.const_2, true);
			TranslateTransform transform = @class.loopingSelectorItem_0.Transform;
			if (transform != null)
			{
				double num = -transform.get_Y() - Math.Round(@class.loopingSelectorItem_0.get_ActualHeight() / 2.0);
				if (this.translateTransform_0.get_Y() != num)
				{
					this.method_10(LoopingSelector.duration_0, this.ieasingFunction_0, num);
				}
			}
		}
		private void method_9()
		{
			if (!this.IsReady)
			{
				return;
			}
			this.queue_0 = new Queue<LoopingSelectorItem>(this.panel_0.get_Children().get_Count());
			using (IEnumerator<UIElement> enumerator = this.panel_0.get_Children().GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					LoopingSelectorItem loopingSelectorItem = (LoopingSelectorItem)enumerator.get_Current();
					if (loopingSelectorItem.method_1() == LoopingSelectorItem.Enum1.const_2)
					{
						loopingSelectorItem.method_0(LoopingSelectorItem.Enum1.const_0, false);
					}
					this.queue_0.Enqueue(loopingSelectorItem);
					loopingSelectorItem.method_3();
				}
			}
			this.panel_0.get_Children().Clear();
			this.method_11();
			this.translateTransform_0.set_Y(0.0);
			this.double_1 = -3.4028234663852886E+38;
			this.double_2 = 3.4028234663852886E+38;
			this.method_13();
		}
		private void method_10(Duration duration_2, IEasingFunction ieasingFunction_2, double double_4)
		{
			double num = Math.Max(this.double_1, Math.Min(this.double_2, double_4));
			if (double_4 != num)
			{
				double num2 = Math.Abs(this.translateTransform_0.get_Y() - double_4);
				double num3 = Math.Abs(this.translateTransform_0.get_Y() - num);
				double num4 = num3 / num2;
				duration_2 = new Duration(TimeSpan.FromMilliseconds((double)duration_2.get_TimeSpan().get_Milliseconds() * num4));
				double_4 = num;
			}
			double y = this.translateTransform_0.get_Y();
			this.method_11();
			CompositionTarget.add_Rendering(new EventHandler(this.method_14));
			this.doubleAnimation_0.set_Duration(duration_2);
			this.doubleAnimation_0.set_EasingFunction(ieasingFunction_2);
			this.doubleAnimation_0.set_From(new double?(y));
			this.doubleAnimation_0.set_To(new double?(double_4));
			this.storyboard_0.Begin();
			this.storyboard_0.SeekAlignedToLastTick(TimeSpan.Zero);
			this.bool_1 = true;
		}
		private void method_11()
		{
			this.storyboard_0.Stop();
			CompositionTarget.remove_Rendering(new EventHandler(this.method_14));
		}
		private void method_12(double double_4)
		{
			double num = this.doubleAnimation_0.get_To().get_Value() - this.doubleAnimation_0.get_From().get_Value();
			double num2 = double_4 - this.translateTransform_0.get_Y();
			double num3 = num2 / num;
			Duration duration_ = new Duration(TimeSpan.FromMilliseconds((double)this.doubleAnimation_0.get_Duration().get_TimeSpan().get_Milliseconds() * num3));
			this.method_10(duration_, this.doubleAnimation_0.get_EasingFunction(), double_4);
		}
		private void method_13()
		{
			if (!this.IsReady)
			{
				return;
			}
			double actualItemWidth = this.ActualItemWidth;
			double actualItemHeight = this.ActualItemHeight;
			this.int_0 = (int)Math.Round(base.get_ActualHeight() * 1.5 / actualItemHeight);
			LoopingSelectorItem loopingSelectorItem;
			if (this.panel_0.get_Children().get_Count() == 0)
			{
				loopingSelectorItem = (this.loopingSelectorItem_0 = this.method_20(this.panel_0, this.DataSource.SelectedItem));
				loopingSelectorItem.Transform.set_Y(-actualItemHeight / 2.0);
				loopingSelectorItem.Transform.set_X((base.get_ActualWidth() - actualItemWidth) / 2.0);
				loopingSelectorItem.method_0(LoopingSelectorItem.Enum1.const_2, false);
			}
			else
			{
				int num = this.method_15();
				loopingSelectorItem = (LoopingSelectorItem)this.panel_0.get_Children().get_Item(num);
			}
			int i;
			LoopingSelectorItem loopingSelectorItem2 = LoopingSelector.smethod_1(loopingSelectorItem, out i);
			int j;
			LoopingSelectorItem loopingSelectorItem3 = LoopingSelector.smethod_2(loopingSelectorItem, out j);
			if (i >= j)
			{
				if (i >= this.int_0)
				{
					goto IL_200;
				}
			}
			while (i < this.int_0)
			{
				object previous = this.DataSource.GetPrevious(loopingSelectorItem2.get_DataContext());
				if (previous != null)
				{
					LoopingSelectorItem loopingSelectorItem4;
					if (j > this.int_0)
					{
						loopingSelectorItem4 = loopingSelectorItem3;
						loopingSelectorItem3 = loopingSelectorItem3.Previous;
						loopingSelectorItem4.method_3();
						ContentControl arg_142_0 = loopingSelectorItem4;
						object content;
						loopingSelectorItem4.set_DataContext(content = previous);
						arg_142_0.set_Content(content);
					}
					else
					{
						loopingSelectorItem4 = this.method_20(this.panel_0, previous);
						loopingSelectorItem4.Transform.set_X((base.get_ActualWidth() - actualItemWidth) / 2.0);
					}
					loopingSelectorItem4.Transform.set_Y(loopingSelectorItem2.Transform.get_Y() - actualItemHeight);
					loopingSelectorItem4.method_5(loopingSelectorItem2);
					loopingSelectorItem2 = loopingSelectorItem4;
					i++;
				}
				else
				{
					this.double_2 = -loopingSelectorItem2.Transform.get_Y() - actualItemHeight / 2.0;
					if (this.bool_1 && this.doubleAnimation_0.get_To().get_Value() > this.double_2)
					{
						this.method_12(this.double_2);
						break;
					}
					break;
				}
			}
			IL_200:
			if (j >= i)
			{
				if (j >= this.int_0)
				{
					goto IL_31D;
				}
			}
			while (j < this.int_0)
			{
				object next = this.DataSource.GetNext(loopingSelectorItem3.get_DataContext());
				if (next != null)
				{
					LoopingSelectorItem loopingSelectorItem5;
					if (i > this.int_0)
					{
						loopingSelectorItem5 = loopingSelectorItem2;
						loopingSelectorItem2 = loopingSelectorItem2.Next;
						loopingSelectorItem5.method_3();
						ContentControl arg_261_0 = loopingSelectorItem5;
						object content2;
						loopingSelectorItem5.set_DataContext(content2 = next);
						arg_261_0.set_Content(content2);
					}
					else
					{
						loopingSelectorItem5 = this.method_20(this.panel_0, next);
						loopingSelectorItem5.Transform.set_X((base.get_ActualWidth() - actualItemWidth) / 2.0);
					}
					loopingSelectorItem5.Transform.set_Y(loopingSelectorItem3.Transform.get_Y() + actualItemHeight);
					loopingSelectorItem5.method_4(loopingSelectorItem3);
					loopingSelectorItem3 = loopingSelectorItem5;
					j++;
				}
				else
				{
					this.double_1 = -loopingSelectorItem3.Transform.get_Y() - actualItemHeight / 2.0;
					if (this.bool_1 && this.doubleAnimation_0.get_To().get_Value() < this.double_1)
					{
						this.method_12(this.double_1);
						break;
					}
					break;
				}
			}
			IL_31D:
			this.queue_0 = null;
		}
		private static LoopingSelectorItem smethod_1(LoopingSelectorItem loopingSelectorItem_1, out int int_1)
		{
			int_1 = 0;
			while (loopingSelectorItem_1.Previous != null)
			{
				int_1++;
				loopingSelectorItem_1 = loopingSelectorItem_1.Previous;
			}
			return loopingSelectorItem_1;
		}
		private static LoopingSelectorItem smethod_2(LoopingSelectorItem loopingSelectorItem_1, out int int_1)
		{
			int_1 = 0;
			while (loopingSelectorItem_1.Next != null)
			{
				int_1++;
				loopingSelectorItem_1 = loopingSelectorItem_1.Next;
			}
			return loopingSelectorItem_1;
		}
		private void method_14(object sender, EventArgs e)
		{
			this.method_13();
		}
		private int method_15()
		{
			if (!this.IsReady)
			{
				return -1;
			}
			double actualItemHeight = this.ActualItemHeight;
			int count = this.panel_0.get_Children().get_Count();
			double y = this.translateTransform_0.get_Y();
			double num = actualItemHeight / 2.0;
			int result = -1;
			double num2 = 1.7976931348623157E+308;
			for (int i = 0; i < count; i++)
			{
				LoopingSelectorItem loopingSelectorItem = (LoopingSelectorItem)this.panel_0.get_Children().get_Item(i);
				double num3 = Math.Abs(loopingSelectorItem.Transform.get_Y() + num + y);
				if (num3 <= num)
				{
					result = i;
					return result;
				}
				if (num2 > num3)
				{
					num2 = num3;
					result = i;
				}
			}
			return result;
		}
		private void storyboard_0_Completed(object sender, EventArgs e)
		{
			CompositionTarget.remove_Rendering(new EventHandler(this.method_14));
			this.bool_1 = false;
			if (this.enum0_0 != LoopingSelector.Enum0.const_2)
			{
				this.method_16();
			}
		}
		private void method_16()
		{
			if (!this.IsReady)
			{
				return;
			}
			int num = this.method_15();
			if (num == -1)
			{
				return;
			}
			LoopingSelectorItem loopingSelectorItem_ = (LoopingSelectorItem)this.panel_0.get_Children().get_Item(num);
			this.method_8(loopingSelectorItem_);
		}
		private void method_17()
		{
			if (!this.IsReady)
			{
				return;
			}
			bool isExpanded = this.IsExpanded;
			using (IEnumerator<UIElement> enumerator = this.panel_0.get_Children().GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					LoopingSelectorItem loopingSelectorItem = (LoopingSelectorItem)enumerator.get_Current();
					if (loopingSelectorItem == this.loopingSelectorItem_0)
					{
						loopingSelectorItem.method_0(LoopingSelectorItem.Enum1.const_2, true);
					}
					else
					{
						loopingSelectorItem.method_0(isExpanded ? LoopingSelectorItem.Enum1.const_1 : LoopingSelectorItem.Enum1.const_0, true);
					}
				}
			}
		}
		private void method_18()
		{
			this.doubleAnimation_0 = new DoubleAnimation();
			Storyboard.SetTarget(this.doubleAnimation_0, this.translateTransform_0);
			Storyboard.SetTargetProperty(this.doubleAnimation_0, new PropertyPath("Y", new object[0]));
			this.storyboard_0 = new Storyboard();
			this.storyboard_0.get_Children().Add(this.doubleAnimation_0);
			this.storyboard_0.add_Completed(new EventHandler(this.storyboard_0_Completed));
		}
		private void method_19()
		{
			base.add_SizeChanged(new SizeChangedEventHandler(this.LoopingSelector_SizeChanged));
			base.add_ManipulationStarted(new EventHandler<ManipulationStartedEventArgs>(this.method_4));
			base.add_ManipulationCompleted(new EventHandler<ManipulationCompletedEventArgs>(this.method_6));
			base.add_ManipulationDelta(new EventHandler<ManipulationDeltaEventArgs>(this.method_5));
			base.add_Tap(new EventHandler<GestureEventArgs>(this.method_3));
			base.AddHandler(UIElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(this.method_1), true);
			base.AddHandler(UIElement.MouseLeftButtonUpEvent, new MouseButtonEventHandler(this.method_2), true);
		}
		private LoopingSelectorItem method_20(Panel panel_1, object object_0)
		{
			bool flag;
			LoopingSelectorItem loopingSelectorItem = (flag = (this.queue_0 != null && this.queue_0.get_Count() > 0)) ? this.queue_0.Dequeue() : new LoopingSelectorItem();
			if (!flag)
			{
				loopingSelectorItem.set_ContentTemplate(this.ItemTemplate);
				loopingSelectorItem.set_Width(this.ItemSize.get_Width());
				loopingSelectorItem.set_Height(this.ItemSize.get_Height());
				loopingSelectorItem.set_Padding(this.ItemMargin);
				loopingSelectorItem.Click += new EventHandler<EventArgs>(this.method_7);
			}
			FrameworkElement arg_91_0 = loopingSelectorItem;
			loopingSelectorItem.set_Content(object_0);
			arg_91_0.set_DataContext(object_0);
			panel_1.get_Children().Add(loopingSelectorItem);
			if (!flag)
			{
				loopingSelectorItem.ApplyTemplate();
			}
			return loopingSelectorItem;
		}
	}
}
